package com.sltx.service.impl;

import com.sltx.dao.aaa.LishijiluMapper;
import com.sltx.service.LishijiluService;
import com.sltx.util.PageData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author Administrator
 * @Date 2023/3/27 9:16
 */
@Service
public class LishijiluServiceImpl implements LishijiluService {


    @Autowired
    private LishijiluMapper lishijiluMapper;
    //展示搜索历史
    @Override
    public List<Object> getLishi(PageData pd) {
        //获取企业名称
        String entname = (String) pd.get("entname");
        //获取用户名称
        String username = (String) pd.get("username");
        pd.put("entname",entname);
        pd.put("username",username);
        List<Object> list = lishijiluMapper.getLishi(pd);
        return list;
    }

    //添加搜索记录
    @Override
    public void insertlishi(PageData pd) {
        //获取企业名称
        String entname = (String) pd.get("entname");
        //获取用户名称
        String username = (String) pd.get("username");
        pd.put("entname",entname);
        pd.put("username",username);
        lishijiluMapper.insertlishi(pd);
    }

    //根据企业名称删除
    @Override
    public void deleteEntname(PageData pd) {
        //获取企业名称
        String entname = (String) pd.get("entname");
        //获取用户名称
        String username = (String) pd.get("username");
        pd.put("entname",entname);
        pd.put("username",username);
        lishijiluMapper.deleteEntname(pd);
    }

    //全部删除
    @Override
    public void delete(PageData pd) {
        //获取用户名称
        String username = (String) pd.get("username");
        pd.put("username",username);
        lishijiluMapper.delete(pd);
    }

    //每周日定时删除历史记录
    @Override
    public void deleteList() {
        lishijiluMapper.deleteList();
    }


}
